<template>
<uni-shadow-root class="partials-banner-banner"><import src="firstBanner.wxml"></import>  
<import src="more_banner/index.wxml"></import>  

<block v-if="data.androidTemplate == ''">
    <template is="firstBanner" :data="...data,sysWidth,...setting,imgs"></template> 
</block> 
<block v-if="data.androidTemplate == 'more_banner'||data.androidTemplate ==='form_more_banner'">
    <template is="moreBanner" :data="...data,sysWidth,...setting,imgs"></template>
</block> 
<block v-if="(!data.androidTemplate&&data.androidTemplate != '')">
    <template is="firstBanner" :data="...data,sysWidth,...setting,imgs"></template>
</block></uni-shadow-root>
</template>
<wxs src="../../public/publicFun.wxs" module="publicFun"></wxs>
<script>

global['__wxRoute'] = 'partials/banner/banner'
const app = getApp();
Component({
  properties: {
    data: {
      type: JSON,
      value: 'default value',
    }
  },
  data: {
    someData: {},
    sysWidth:"",
    setting:{},
    imgs:null,
  },
  ready:function(){
    let that=this;
    that.setData({
      sysWidth: app.globalData.sysWidth,
      setting:app.globalData.setting
    });
    console.log("=====banner--data=====", that.data.data)
  },
  methods: {
    imageLoad: function (e) {
      let that=this;
      console.log("=====imageLoad====",e,that.data.data.jsonData.height,that.data.sysWidth)
      let index = e.currentTarget.dataset.index;
      let width = e.detail.width;
      let height = e.detail.height;
      let imgData = that.data.data.jsonData.images;
      let fixedHeght = Number(that.data.data.jsonData.height) * that.data.sysWidth;
      imgData[index].height = fixedHeght;
      imgData[index].width = (width / height ) * fixedHeght;
      that.setData({ imgs: imgData })
      console.log("=====imageLoad====", that.data.imgs)
    },
    tolinkUrl: function (event) {
      console.log(event.currentTarget.dataset.link)
      app.globalData.linkEvent(event.currentTarget.dataset.link);
    }
  },
})
export default global['__wxComponents']['partials/banner/banner']
</script>
<style platform="mp-weixin">
@import 'more_banner/index.css';/* 引入可以滑动的样式 */
.SwiperContainer{
  height: 9em;
  width: 100%;
  background: #fff;
}
.SwiperIndex{
  width: 100%;
  height: 100%;
}
.SwiperIndex image{
  height:100%;
  width: 100%;
}
</style>